package com.star.basedemo.service;

import com.star.basedemo.bean.Student;
import com.star.basedemo.log.Oplog;
import com.star.basedemo.mapper.StudentMapper;
import com.star.basedemo.mapper.first.StudentFirstMapper;
import com.star.basedemo.mapper.minor.StudentMinorMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentService {

    @Autowired
    private StudentMapper studentMapper;
    /**
     * 查询全部
     *
     * @return
     */
    public List<Student> all1() {
        return studentMapper.getAll();
    }
    /**
     * 查询全部
     *
     * @return
     */
    public List<Student> all2() {
        return studentMapper.getAll();
    }

    /**
     * 删除学生信息
     *
     * @param Id
     * @return
     */
    @Oplog(value = "这是个测试信息", actionType = "删除")
    public int del(Integer Id) {
        return studentMapper.deleteById(Id);
    }

    /**
     * 修改
     * @param student 修改的学生信息
     * @return
     */
    public int update(Student student) {
        return studentMapper.update(student);
    }

    /**
     *
     * @param student 添加
     * @return
     */
    @Oplog(value = "这是一个测试value",actionType = "添加学生信息")
    public int save(Student student){
        return studentMapper.insert(student);
    }
}
